package com.stx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.stx.mapper.JudgeMapper;
import com.stx.pojo.Judge;
import com.stx.service.IJudgeService;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class JudgServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements IJudgeService {
    @Override
    public List<Judge> findByName(Judge judge) {
        LambdaQueryWrapper<Judge> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Judge::getJudUsername, judge.getJudUsername());
        List<Judge> judges = baseMapper.selectList(queryWrapper);
        return judges;

    }

    @Override
    public Judge findByUsername(String username) {
        LambdaQueryWrapper<Judge> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Judge::getJudUsername, username);
        return baseMapper.selectOne(queryWrapper);
    }
}
